package com.antcom.antread.common.core.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 文件读取配置文件
 *
 * @Author 中国蚂蚁技术有限公司
 * @create 2020/12/28 21:56
 */
@Configuration
public class WebVirtualPathConfig implements WebMvcConfigurer {

    @Value("${virtual.path}")
    private String resourceHandler;
    @Value("${basePath}")
    private String resourceLocations;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(resourceHandler).addResourceLocations("file:///" + resourceLocations + "/");
    }
}
